import { ERROR_CODE, SUCCESS_CODE } from "../config/code";

export interface resType<T> {
    code: number;
    msg: string | null;
    data: T | null;
}

export const responseSuccess = <T>(data: T | null, msg: string | null = null): resType<T> => ({
  code: SUCCESS_CODE,
  msg,
  data,
});
export const responseError = <T>(msg: string | null, data: T | null = null): resType<T> => ({
  code: ERROR_CODE,
  msg,
  data,
});

 